package com.itheima.mapper;

import com.itheima.domain.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StudentMapper {
    @Select("SELECT * FROM tb_student")
    List<Student> findAlL();

    @Select("SELECT * FROM tb_student WHERE id=#{id}")
    Student findById(Integer id);

    @Update("UPDATE tb_student SET number=#{number},user_name=#{userName},birthday=#{birthday},address=#{address} WHERE id=#{id}")
    void update(Student student);

    @Insert("INSERT INTO tb_student VALUES (NULL,#{number},#{userName},#{birthday},#{address})")
    void save(Student student);

    @Delete("DELETE FROM tb_student WHERE id=#{id}")
    void delete(Integer id);
}
